Skip to content

feat(apps): Add Generate App Manifest functionality #244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 5, 2025

Conversation

daviddmd
Copy link
Contributor

The Cloud Foundry V3 API reference specifies a manifest endpoint for apps that returns the computed app manifest YAML (string), matching the cloudfoundry-application-manifest.json schema.

I've added the get_manifest method to the AppManager class of the cloudfoundry_client/v3/apps.py module that consumes this API endpoint.

Example:

manifest: str = client.v3.apps.get_manifest(application_guid="97bcba72-43f2-4197-8136-fe178c22846f")
manifest_dict: dict = yaml.safe_load(manifest)

I've also introduced a fix to the _append_encoded_parameter function of the _get_url_filtered method of the entities module of the networking package, in order to append the GET parameters with the %s=%s format, in line with what the Policy Server API interface expects for its GET requests.

Example:

GET /networking/v1/external/policies
GET /networking/v1/external/policies?id=97bcba72-43f2-4197-8136-fe178c22846f
GET /networking/v1/external/policies?dest_id=8e05d3db-bebf-4373-a9f7-c68686aea169

As of now, the following doesn't work as intended:

client.networking_v1_external.policies.list(**{"id":"97bcba72-43f2-4197-8136-fe178c22846f"})

Expected: https://<cf-instance>/networking/v1/external/policies?id=97bcba72-43f2-4197-8136-fe178c22846f

Actual: https://<cf-instance>/networking/v1/external/policies?q=id%3A97bcba72-43f2-4197-8136-fe178c22846f, which yields all network policies present in the CF instance.

daviddmd added 2 commits June 27, 2025 16:38
fix(networking): Update _append_encoded_parameter function to append the parameters with the %s=%s format, in order to be compliant with the Policy Server API interface
@antechrestos
Copy link
Member

@daviddmd thank you for this contribution.

Would you mind adding a test for the get_manifest feature?

Thank you

@daviddmd
Copy link
Contributor Author

daviddmd commented Jul 5, 2025

@antechrestos I've added the test for the get_manifest function and the respective mock response YAML file, sourced from the v3 Cloud Controller API Reference.

I've imported the PyYAML (yaml) library in the test_apps module in order to retrieve the values of the mock manifest response (YAML string) fields.

@antechrestos antechrestos merged commit 16a181d into cloudfoundry-community:main Jul 5, 2025
5 checks passed
@antechrestos
Copy link
Member

@daviddmd thank you very much, I will do a fresh release tomorrow. Good evening

@antechrestos
Copy link
Member

released in 1.38.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants